/*===========================================================================
  Copyright (C) 2014 by the Okapi Framework contributors
-----------------------------------------------------------------------------
  This library is free software; you can redistribute it and/or modify it 
  under the terms of the GNU Lesser General Public License as published by 
  the Free Software Foundation; either version 2.1 of the License, or (at 
  your option) any later version.

  This library is distributed in the hope that it will be useful, but 
  WITHOUT ANY WARRANTY; without even the implied warranty of 
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 
  General Public License for more details.

  You should have received a copy of the GNU Lesser General Public License 
  along with this library; if not, write to the Free Software Foundation, 
  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

  See also the full LGPL text here: http://www.gnu.org/copyleft/lesser.html
===========================================================================*/

package net.sf.okapi.v2.common.om;

import net.sf.okapi.v2.common.exceptions.InvalidParameterException;

/**
 * Represents a document.
 */
public interface IDocument extends IWithAnnotations, Iterable<ISubDocument> {

	/**
	 * Adds a new {@link ISubDocument} to this document.
	 * @param subDoc the new sub-document to add.
	 * (must not be null or have an id already used by another sub-document in this document),
	 * @return the added sub-document.
	 * @throws InvalidParameterException if the parameter is null or used by another sub-document.
	 */
	public ISubDocument add (ISubDocument subDoc);

	/**
	 * Gets the sub-document for a given id.
	 * @param id the id of the sub-document to return.
	 * @return the sub-document for the given id, or null if no such sub-document is found.
	 */
	public ISubDocument get (String id);

	/**
	 * Removes from this document the sub-document with a given id.
	 * If such sub-document is not found nothing is done.
	 * @param id the id of the sub-document to remove.
	 */
	public void remove (String id);

}
